import Vue from "vue";
import Vuex from "vuex";

const modules = {};
const modulesFiles = require.context("./modules", true, /\.js$/);
// console.log(modulesFiles.keys());
modulesFiles.keys().forEach(key => {
  const module = modulesFiles(key);
  const moduleName = key.replace(/^\.\/(.*)\.\w+$/, "$1");
  modules[moduleName] = module.default || module;
});
Vue.use(Vuex);
export default new Vuex.Store({
  modules
});
